package it.heima.springbootinit.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wuli
 * @create 2021-10-20 22:35
 */
@RestController
public class HelloController {

    @Value("${name}")
    private String name;

    @Autowired
    private Environment env;

    @RequestMapping("/hello")
    public String hello() {
        System.out.println(env.getProperty("name"));
        return "hello Spring Boot 2!" + name;
    }
}
